
@extends('admin.master')

@section('title', '用户信息')

@section('title_top')
    @parent
    <div class="title_top">用户信息</div>
@stop

@section('equip_query')
<div class="equip_num"><p>用户编号</p><input class="name_inp" type="text" value="{{ $username or '' }}" /></div>
<div class="equip_status"><p>电话</p><input class="telepho_inp" type="text" value="{{ $phone or '' }}" /></div>
<a class="query_btn query_user">查询</a>
@stop

@section('userinfo_tab')
<table cellpadding="0" cellspacing="0" class="userinfo_tab">
	<thead>
		<tr>
			<td>用户编号</td>
			<td>姓名</td>
			<td>性别</td>
			<td>当前绑定设备</td>
			<td>已绑定设备</td>
			<td>地址</td>
			<td>邮箱</td>
			<td>电话</td>
		</th>
	</thead>
	<tbody>
		@foreach($userInfoList as $userInfo)
		<tr >
			<td>{{ $userInfo->wxUser->open_id }}</td>
			<td>{{ $userInfo->name or '' }}</td>
			<td>{{ $userInfo->sex_description or '' }}</td>
			<td>{{ $userInfo->wxUser->current_device_code or '' }}</td>
			<td>
			@foreach($userInfo->wxUser->devices as $device)
			{{ $device->code }}<br>
			@endforeach
			</td>
			<td>{{ $userInfo->address or '' }}</td>
			<td>{{ $userInfo->email or '' }}</td>
			<td>{{ $userInfo->phone or '' }}</td>
		</tr>
		@endforeach
	</tbody>
</table>
@stop

@section('page_num') 
    <ul class="pagination pagination-lg">
    @if(count($userInfoList))
    	<?php 
    	$queryParam = empty($username)? []: ['username' => $username];
    	$queryParam = empty($phone)? $queryParam: array_merge($queryParam, ['phone' => $phone]); ?>
        {!! $userInfoList->appends($queryParam)->render() !!}
    @endif
    </ul>
@stop
@section('infor_promit')
@parent
<script type="text/javascript">
    //用户信息查询
    $(".query_user").click(function(){
        var name_in=$(".name_inp").val();
        var tel_in=$(".telepho_inp").val();
        if(name_in=="%"){
	    	hint("用户编号非法输入，请正确输入！");
	    }else if(tel_in==""||/^\d{1,11}$/.test(tel_in)){ 
            window.location.href='/admin/user/info-list?username='+name_in+'&phone='+tel_in;
        }else{
            hint("电话输入格式有误，请重新输入！若输入固话，输入格式如“区号+固话”");  
        }
    });
</script>
@stop